import { getDataList } from '@/services/global/specialZone';

const Model = {
  namespace: 'globalSpecialZone',
  state: {
    lgbListData: {},
  },
  effects: {
    *getDataList({ payload, resolve }, { call, put }) {
      const params = {
        ...payload,
      };

      const response = yield call(getDataList, params);

      if (!response.error) {
        const result = {
          data: response,
          success: true,
        };

        resolve && resolve(result);

        yield put({
          type: 'save',
          payload: {
            lgbListData: result,
          },
        });
      }
    },
  },
  reducers: {
    save(state, { payload }) {
      return { ...state, ...payload };
    },
  },
};
export default Model;
